﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace System.Web.UI
{
    /// <summary>
    ///BasePage 的摘要说明
    /// </summary>
    public class BasePage : System.Web.UI.Page
    {
        public BasePage()
        {
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

        }
        protected override void OnLoad(EventArgs e)
        {
            // 判断是否登录的相关逻辑代码
            if (!IsManager)
            {
                Response.Redirect("http://www.toook.com");
            }
            base.OnLoad(e);

            //Type tp = this.GetType();
            //string fullname = tp.BaseType.FullName;
            //string nameSpace = fullname.Remove(fullname.LastIndexOf("."));
        }
        ///// <summary>
        ///// 判断管理员用户名、密码是否正确
        ///// </summary>
        ///// <param name="userId"></param>
        ///// <param name="pwd"></param>
        ///// <returns></returns>
        //public bool IsValidManager(string userId, string pwd)
        //{
        //    if(userId == "toookNest99" && pwd == "nest99MOVIE")
        //    {
        //        return true;
        //    }
        //    return false;
        //}
        public bool IsManager
        {
            get
            {
                return NstUserId == "toookNest99";
            }
        }
        public string NstUserId
        {
            get
            {
                if (Session["NstUserId"] != null)
                {
                    return Session["NstUserId"].ToString();
                }
                else
                {
                    return "";
                }
            }
            set
            {
                Session["NstUserId"] = value;
            }
        }
    }
}